package com.smile.chatview;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;
import javax.swing.JPanel;

public class LoginPanel extends JPanel {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private BufferedImage image;

	public LoginPanel() {
		super();
		try {
			image = ImageIO.read(new File("resources/img/usericon.png"));
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	@Override
	protected void paintComponent(Graphics g) {
		Graphics2D g2d = (Graphics2D) g;
		g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
				RenderingHints.VALUE_ANTIALIAS_ON);
		g2d.setColor(new Color(236, 236, 236));
//		g2d.setColor(new Color(51, 51, 51));
		g2d.fillRoundRect(0, 45, getWidth(), getHeight() - 45, 50, 50);
		if (image != null) {
			g2d.drawImage(image, getWidth() / 2 - 45, 0, 90, 90, null);
		}
	}
}
